package com.zerui.manager.icc.strategy;

import com.alibaba.cola.exception.BizException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class ICCCommandHandler {

    /**
     * 交由Spring容器注入
     */
    @Autowired
    private Map<String, CommandStrategy> commandStrategyMap = new HashMap<>();

    public CommandStrategy getCommand(final String operate) {
        if (commandStrategyMap.containsKey(operate))
            return commandStrategyMap.get(operate);
        throw new BizException("不支持的操作指令");
    }
}
